<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>首页</title>
	<!-- basic styles -->

	<link rel="stylesheet" href="${ctx}/css/assets/css/bootstrap.min.css" />
	<link rel="stylesheet" href="${ctx}/css/assets/css/ace.min.css" />
	<link rel="stylesheet" href="${ctx}/css/assets/css/ace-rtl.min.css" />
	<link rel="stylesheet" href="${ctx}/css/assets/css/ace-skins.min.css" />
	<link rel="stylesheet" href="${ctx}/css/assets/css/font-awesome.min.css" />


	<%--<link rel="stylesheet" href="${ctx}/css/oacc/lightmvc.css" type="text/css">--%>
	<!--[if lte IE 8]>
	<link rel="stylesheet" href="${ctx}/css/assets/css/ace-ie.min.css" />
	<![endif]-->

	<!-- ace settings handler -->
	<script src="${ctx}/css/assets/js/ace-extra.min.js"></script>
	<script type="text/javascript" src="${ctx}/jquery/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="${ctx}/jquery/easyui1.4.2/jquery.easyui.min.js" charset="utf-8"></script>
	<script type="text/javascript" src="${ctx}/jquery/easyui1.4.2/locale/easyui-lang-zh_CN.js" charset="utf-8"></script>
	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

	<!--[if lt IE 9]>
	<script src="${ctx}/css/assets/js/html5shiv.js"></script>
	<script src="${ctx}/css/assets/js/respond.min.js"></script>
	<![endif]-->

	<script type="text/javascript">
        var index_layout;
        var index_tabs;
        var index_tabsMenu;
        var layout_west_tree;
        var layout_west_tree_url = '';
        var sessionInfo_userId = '${sessionInfo.id}';
        if (sessionInfo_userId) {//如果没有登录,直接跳转到登录页面
            layout_west_tree_url = '${ctx}/resource/tree';
        }else{
            window.location.href='${ctx}/admin/index';
        }
        $(function() {
            index_layout = $('#index_layout').layout({
                fit : true
            });

            index_tabs = $('#index_tabs').tabs({
                fit : true,
                border : false,
                tools : [{
                    iconCls : 'icon-home',
                    handler : function() {
                        index_tabs.tabs('select', 0);
                    }
                }, {
                    iconCls : 'icon-refresh',
                    handler : function() {
                        var index = index_tabs.tabs('getTabIndex', index_tabs.tabs('getSelected'));
                        index_tabs.tabs('getTab', index).panel('open').panel('refresh');
                    }
                }, {
                    iconCls : 'icon-del',
                    handler : function() {
                        var index = index_tabs.tabs('getTabIndex', index_tabs.tabs('getSelected'));
                        var tab = index_tabs.tabs('getTab', index);
                        if (tab.panel('options').closable) {
                            index_tabs.tabs('close', index);
                        }
                    }
                } ]
            });

            layout_west_tree = $('#layout_west_tree').tree({
                url : layout_west_tree_url,
                parentField : 'pid',
                lines : true,
                onClick : function(node) {
                    if (node.attributes && node.attributes.url) {
                        var url = '${ctx}' + node.attributes.url;
                        addTab({
                            url : url,
                            title : node.text,
                            iconCls : node.iconCls
                        });
                    }
                }
            });
        });

        function addTab(params) {
            var iframe = '<iframe src="' + params.url + '" frameborder="0" style="border:0;width:100%;height:99.5%;"></iframe>';
            var t = $('#index_tabs');
            var opts = {
                title : params.title,
                closable : true,
                iconCls : params.iconCls,
                content : iframe,
                border : false,
                fit : true
            };
            if (t.tabs('exists', opts.title)) {
                t.tabs('select', opts.title);
            } else {
                t.tabs('add', opts);
            }
        }

        function logout(){
            window.location.href='${ctx}/admin/logout';
        }

        function myrefresh()
        {
            parent.location.reload();
        }
        function showTop() {

        }

	</script>
	<style type="text/css">
		#navbar
		{
			height:60px;
			background-color: rgba(255,255,255,0.8);
			border-bottom: 5px solid rgba(50,50,50,0.5);
		}
	</style>
</head>


<body style="overflow: hidden;height: 60px;padding:0px;background: rgba(0,0,0,0);">
<%--<div onclick="showTop()" style="left: 45%;position: absolute;width: 10%;height: 40px;background-color: rgba(60,142,100,0.55);"></div>--%>
<div class="navbar navbar-default" id="navbar">
	<script type="text/javascript">
        try{ace.settings.check('navbar' , 'fixed')}catch(e){}
	</script>
	<div class="navbar-container" id="navbar-container">
		<div class="navbar-header pull-left">
			<a href="#" class="navbar-brand">
				<small onclick="myrefresh()">
					<img src="${ctx}/img/FAVICON.png" width="50"style="margin-top:10px;margin-left:20px">
					<p style="font-family: '微软雅黑';letter-spacing: 3px; color:black;font-size: large;top: 37%;left: 100px;position: absolute;">
						武重数控机床远程状态监测云服务平台
					</p>
				</small>
			</a><!-- /.brand -->
		</div><!-- /.navbar-header -->

		<%--<div class="navbar-header pull-right" role="navigation" style="line-height:7.8;width:200px">--%>
		<%--<span style="float: right; padding-left:11px;padding-right: 1px;">欢迎 <b>${sessionInfo.name}</b>&nbsp;&nbsp;--%>
		<%--<a href="${ctx}/admin/quit"  style="color: #333" target="_parent">安全退出</a>--%>
		<%--&nbsp;&nbsp;--%>
		<%--</span>--%>
		<%--</div>--%>
		<div class="navbar-header pull-right" role="navigation">
			<ul class="nav ace-nav">

				<li class="light-blue">
					<a data-toggle="dropdown" href="#" class="dropdown-toggle" style="top: 15%;background-color: rgba(100,100,100,0.6)" onclick="window.open('${ctx}/user/quit','_parent')">
						<img class="nav-user-photo" src="${ctx}/css/assets/avatars/avatar2.png" alt="login_admin" />
						<span class="user-info">
                                    <small>欢迎光临 ^ω^</small>
                                    ${sessionInfo.name}
                                </span>
						<i class="icon-caret-down"></i>
					</a>
				</li>
			</ul>
		</div><!-- /.navbar-header -->

	</div><!-- /.navbar-header -->
</div><!-- /.container -->

</body>
</html>